package com.jinsi.service.impl;

import com.jinsi.mapper.StudentBonusMapper;
import com.jinsi.pojo.ScStudentBonus;
import com.jinsi.service.StudentBonusService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class StudentBonusServiceImpl implements StudentBonusService {
    @Autowired
    private StudentBonusMapper mapper;

    @Override
    public List<ScStudentBonus> getBonus() {
        List<ScStudentBonus> list = mapper.getBonus();
        return list;
    }

    @Override
    public void addBonus(ScStudentBonus bonus) throws Exception {
        int num = mapper.addBonus(bonus);
        if (num == 0){
            throw new Exception();
        }
    }

    @Override
    public void delBonus(Integer id) throws Exception {
        int num = mapper.delBonus(id);
        if (num == 0){
            throw new Exception();
        }
    }
}
